///////////////////////////////////////////////
//Author: Juhapekka Piiroinen
//License: GPLv3
//Webpage: http://code.google.com/p/cutechat
///////////////////////////////////////////////

#include "contactpage.h"
#include "ui_contactpage.h"

ContactPage::ContactPage(QString bareJid, QWidget *parent) :
    QWidget(parent),
    ui(new Ui::ContactPage)
{
    this->bareJid = bareJid;
    ui->setupUi(this);
}

ContactPage::~ContactPage()
{
    delete ui;
}


void ContactPage::receiveMessage(QString message) {
    ui->textEdit->append(QString("%0 - %1 said:\n%2\n").arg(QDateTime::currentDateTime().toString()).arg(this->fullName).arg(message));
}

void ContactPage::updatePage() {
   /* ui->labelAvatar->setPixmap(QPixmap::fromImage(this->avatar));
    ui->labelFullname->setText(this->fullName);
    ui->labelNickname->setText(this->nickName);
    ui->labelBareJid->setText(this->bareJid);*/
}

void ContactPage::on_lineEditSendMessage_returnPressed() {
    QString msg = ui->lineEditSendMessage->text();
    ui->textEdit->append(QString("%0 - You said:\n%1\n").arg(QDateTime::currentDateTime().toString()).arg(msg));
    ui->lineEditSendMessage->setText("");
    emit sendMessage(msg);
}
